Skip to content

Use ZEND_TOSTRING_FUNC_NAME #5736

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed

Use ZEND_TOSTRING_FUNC_NAME #5736

wants to merge 3 commits into from

Conversation

moliata
Copy link
Contributor

@moliata moliata commented Jun 18, 2020

Replaces "__toString" with a specialized constant ZEND_TOSTRING_FUNC_NAME.

Copy link
Contributor

@carusogabriel carusogabriel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👎 on this one. ZEND_TOSTRING_FUNC_NAME is tostring, which is not aligned with toString.

@moliata
Copy link
Contributor Author

moliata commented Jun 18, 2020

👎 on this one. ZEND_TOSTRING_FUNC_NAME is tostring, which is not aligned with toString.

@carusogabriel Nice catch!

Copy link
Contributor

@carusogabriel carusogabriel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, wait, you're using method_lcname, I didn't see that, sorry. 👍 on this case

@moliata
Copy link
Contributor Author

moliata commented Jun 18, 2020

Oh, wait, you're using method_lcname, I didn't see that, sorry. on this case

I wasn't using it before, I just pushed a new commit addressing your review. Thanks!

@@ -6465,7 +6465,7 @@ void zend_compile_func_decl(znode *result, zend_ast *ast, zend_bool toplevel) /*
}

zend_compile_params(params_ast, return_type_ast,
is_method && zend_string_equals_literal_ci(decl->name, "__toString") ? IS_STRING : 0);
is_method && zend_string_equals_literal_ci(method_lcname, ZEND_TOSTRING_FUNC_NAME) ? IS_STRING : 0);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
is_method && zend_string_equals_literal_ci(method_lcname, ZEND_TOSTRING_FUNC_NAME) ? IS_STRING : 0);
is_method && zend_string_equals_literal(method_lcname, ZEND_TOSTRING_FUNC_NAME) ? IS_STRING : 0);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, updated the PR. I'm not sure though what's the difference, I suppose the _ci version is case insensitive?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that's correct.

@php-pulls php-pulls closed this in 48e16a9 Jun 18, 2020
@moliata moliata deleted the use_zend_tostring_func_name branch June 20, 2020 19:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants